from schemas import  SensitiveReport
import smtplib
from email.message import EmailMessage

# 邮件配置（需替换为实际参数）
SMTP_CONFIG = {
	"host": "smtp.qq.com",
	"port": 587,
	"user": "miss-tree@foxmail.com",
	"password": "hlrbdzrtanchbgce",  # QQ邮箱需使用授权码
	"from": "miss-tree@foxmail.com",
	"to": "515072052@qq.com"
}


def send_email(content: str):
	msg = EmailMessage()
	msg.set_content(f"敏感词告警内容：\n{content}")
	msg["Subject"] = "敏感词检测告警"
	msg["From"] = SMTP_CONFIG["from"]
	msg["To"] = SMTP_CONFIG["to"]
	
	with smtplib.SMTP(SMTP_CONFIG["host"], SMTP_CONFIG["port"]) as server:
		server.starttls()
		server.login(SMTP_CONFIG["user"], SMTP_CONFIG["password"])
		server.send_message(msg)